<?php
declare (strict_types = 1);

namespace app;

use think\Service;
use think\Validate;

/**
 * 应用服务类
 */
class AppService extends Service
{
    public function register()
    {
        // 服务注册
    }

    public function boot()
    {
        // 服务启动
        Validate::maker(function ($validate) {
				$validate->extend('isMobile', function ($value) {
					$rule = '^1(3|4|5|7|8)[0-9]\d{8}$^';

					return preg_match($rule, $value) ? true : false;
				});

				$validate->extend('isNullString', function ($value) {
					$rule = "/^[\\s]*$/";
					//表明是空字符串
					return  preg_match($rule, $value) == 1 ? false : true;
				});

			});
    }
}
